﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using Dapper.Contrib.Extensions;
using DapperExtensions.Mapper;

namespace MaximServices.Model
{
    public class MottoBaike
    {
        public string Id { get; set; }

        public string MottoId { get; set; }

        public string Keyword { get; set; }

        public string BaikeContent { get; set; }

        public int BaikeCount { get; set; }

        public DateTime CreateTime { get; set; }

        public DateTime ModifyTime { get; set; }
    }

    public class MottoBaikeMapper : ClassMapper<MottoBaike>
    {
        public MottoBaikeMapper()
        {
            //use different table name
            Table("motto_baike");

            //use a custom schema
            Schema("");

            //have a custom primary key
            Map(x => x.Id).Column("id").Key(KeyType.Assigned);

            Map(x => x.MottoId).Column("motto_id");
            Map(x => x.Keyword).Column("keyword");
            Map(x => x.BaikeContent).Column("baike_content");
            Map(x => x.BaikeCount).Column("baike_count");
            Map(x => x.CreateTime).Column("create_time");
            Map(x => x.ModifyTime).Column("modify_time");

            //optional, map all other columns
        }
    }
}
